package com.xiongwei.flyweight;

import java.util.HashMap;
import java.util.Map;

public class WebsiteFactory {


    Map<String, ConcreteWebsite> pool = new HashMap<>();

    public Website getWebsiteByType(String type) {
        if (pool.containsKey(type)) {
            return pool.get(type);
        }
        pool.put(type, new ConcreteWebsite(type));
        return (Website)pool.get(type);
    }

    public int getWebsiteCount() {
        return pool.size();
    }
}
